package com.sky.java.basic.ArrayDemo;

import java.util.Random;
import java.util.Scanner;

public class Demo1 {
    public static void main(String[] args) {
        int [] codes = new int[5];

        Scanner sc = new Scanner(System.in);

        for (int i = 0; i < codes.length; i++) {
            System.out.println("请输入第" + (i+1) + "位员工的编号");

            codes[i] = sc.nextInt();
        }

        Random r = new Random();
        for (int i = 0; i < codes.length; i++) {
            int index = r.nextInt(codes.length);

            int temp = codes[i];

            codes[i] = codes[index];
            codes[index] = temp;
        }

        for (int i = 0; i < codes.length; i++) {
            System.out.print(codes[i] + " ");
        }
    }
}
